<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="com.gsmr.util.Md5Util"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GSMR系统-主界面</title>
<%
	// 权限验证
	if(session.getAttribute("currentMemberShip")==null){
		response.sendRedirect("login.jsp");
		return;
	}
%>
<style type="text/css">
.home_icon {
	display:inline-block; 
	background: url(image/bsccalc.png); 
	width:150px; 
	height:130px;  
	background-repeat: no-repeat; 
	background-position:50% 50%;  
	line-height: 280px; 
	text-align: center;
	margin: 20px;
	text-decoration: none;
	color: black
}
</style>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/themes/default/easyui.css">

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/WangGuanMenu/queryWangGuanMenu.js"></script>
<script type="text/javascript">

	var url;
	
	function openTab(text,url,iconCls){

		if($("#tabs").tabs("exists",text)){
			$("#tabs").tabs("select",text);
		}else{
			var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='${pageContext.request.contextPath}/page/"+url+"'></iframe>";
			$("#tabs").tabs("add",{
				title:text,
				iconCls:iconCls,
				closable:true,
				content:content
			});
		}
	}
	
	function openPasswordModifyDialog(){
		$("#dlg").dialog("open").dialog("setTitle","修改密码");
		url="${pageContext.request.contextPath}/user/modifyPassword.do?id=${currentMemberShip.user.id}&password=${currentMemberShip.user.password}";
	}
	
	function modifyPassword(){
		$("#fm").form("submit",{
			url:url,
			onSubmit:function(){
				var oldPassword=$("#oldPassword").val();
				var newPassword=$("#newPassword").val();
				var newPassword2=$("#newPassword2").val();
				if(!$(this).form("validate")){
					return false;
				}
				if(newPassword!=newPassword2){
					$.messager.alert("系统提示","确认密码输入错误！");
					return false;
				}
				return true;
			},
			success:function(result){
				var result=eval('('+result+')');
				if(result.success){
					$.messager.alert("系统提示","密码修改成功，下一次登录生效！");
					resetValue();
					$("#dlg").dialog("close");
				}else{
					if(result.msg!=null&&result.msg=="用户原密码输入错误！"){
						$.messager.alert("系统提示",result.msg);
					}else{
						$.messager.alert("系统提示","密码修改失败！");
					}
					return;
				}
			}
		 });
	}
	
	function closePasswordModifyDialog(){
		resetValue();
		$("#dlg").dialog("close");
	}
	
	function resetValue(){
		$("#oldPassword").val("");
		$("#newPassword").val("");
		$("#newPassword2").val("");
	}
	
	function logout(){
		$.messager.confirm("系统提示","您确定要退出系统吗？",function(r){
			if(r){
				window.location.href='${pageContext.request.contextPath}/user/logout.do';
			} 
		 });
	}
	
	function openScanGate(){
		$.messager.confirm("系统提示","您确定要开启实时扫描功能吗？",function(r){
			if(r){
				$.messager.alert("系统提示","有待开发！");
			} 
		 });
	}
	
	function openWangGuan(){
		$.messager.confirm("系统提示","您确定要调用网管系统插件程序吗？",function(r){
			if(r){
				window.open('${pageContext.request.contextPath}/main/openWangGuan.do');
			} 
		 });
	}
	
	
	function getQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		var r = window.location.search.substr(1).match(reg);
		if ( r != null ){
		   return decodeURI(r[2]);
		}else{
		   return null;
		} 
	}
	
	function getTitle() {
		var db = getQueryString("database");
		var welcome = '欢迎使用' + db + 'GSM-R空口监测系统'+'3.0';
		//var welcome = '欢迎使用' + db + '铁路通信系统大数据监控平台';
		console.log(welcome);
		$("#welcome").html(welcome);
	}
	$(function(){
		getTitle();
	});


	/*
	$.post("${pageContext.request.contextPath}/serverState/getServerId.do", function(result) {
		console.log(result);
		//var welcome = '';result.serverId == 1 ? "欢迎登陆广深港GSM-R空口监测系统！" : "欢迎登陆广深GSM-R空口监测系统！";
		var welcome = '欢迎登录' + result[0].name + 'GSM-R空口监测系统';
		
		if (result.serverId == 1) {
			welcome = "欢迎登录广深港线GSM-R空口监测系统";
		} else if (result.serverId == 2) {
			welcome = "欢迎登录广深线GSM-R空口监测系统";
		} else if (result.serverId == 3) {
			welcome = "欢迎登录测试GSM-R空口监测系统";
		} else if (result.serverId == 4) {
			welcome = "欢迎登录怀邵衡GSM-R空口监测系统";
		}
		
		console.log(welcome);
		$("#welcome").html(welcome);
		if(!window.localStorage){
            return false;
        }else{
            var storage=window.localStorage;
            storage["welcome"]=welcome;
        }
		
	}, "json");
	*/
	
</script>
</head>

<body class="easyui-layout">

<div region="north" style="height: 36px;background-color: #E0ECFF; display:flex;align-items:center">
	<!--<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;<strong id="welcome">欢迎使用广深港线GSM-R空口监测系统！</strong></font>-->
	<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;<strong id="welcome">欢迎使用铁路通信系统大数据平台</strong></font>
</div>

<div region="center">
	<div class="easyui-tabs" fit="true" border="false" id="tabs">
		<div title="首页" data-options="iconCls:'icon-home'">
			<div align="center" style="padding-top: 100px; height:100%; background: url(image/1.png) no-repeat; background-size: cover">
				<a href="javascript:openTab('频谱监测','monitor/monitor.jsp','icon-deploy')" class="home_icon" style="background: url(image/realtime.png) no-repeat;"><strong>频谱监测</strong></a>
				<!--<a href="javascript:openTab('频谱回放','fsreplay/fsreplay.jsp','icon-conference')" class="home_icon" style="background: url(image/monitor.png) no-repeat;"><strong>频谱回放</strong></a>-->
				<a href="javascript:openTab('Um接口电路域查询','um_circuit_domain/circuitQuery.jsp','icon-network')" class="home_icon" style="background: url(image/network.png) no-repeat;"><strong>Um接口电路域查询</strong></a>
				<a href="javascript:openTab('干扰分析','/page_interference/interferenceAnalysis.jsp','icon-cellcompare')" class="home_icon" style="background: url(image/cellcompare.png) no-repeat;"><strong>干扰分析</strong></a><br><br>
				<a href="javascript:openTab('Um接口分组域查询','/um_packet_domain/packetDomainQuery.jsp','icon-total')" class="home_icon" style="background: url(image/total.png) no-repeat;"><strong>Um接口分组域查询</strong></a>
				<!--<a href="javascript:openTab('网络性能分析','networkAnalysis/test.jsp','icon-monit')" class="home_icon" style="background: url(image/bsccalc.png) no-repeat;"><strong>网络性能分析</strong></a>-->
				<a href="javascript:openTab('网管管理','networkManagement/networkManagementSystem.jsp','icon-yewu')" class="home_icon" style="background: url(image/wangguan.png) no-repeat;"><strong>网管管理</strong></a>
				<a href="javascript:openTab('系统管理','/systemConf/systemConf.jsp','icon-jiancetai')" class="home_icon" style="background: url(image/jiancetai.png) no-repeat;"><strong>系统管理</strong></a>
				<!--<a href="javascript:openTab('频谱监测','monitor/monitor.jsp','icon-deploy')" class="home_icon" style="background: url(image/realtime.png) no-repeat;"><strong>系统实时拓扑</strong></a>-->
				<!--<a href="javascript:openTab('频谱回放','fsreplay/fsreplay.jsp','icon-conference')" class="home_icon" style="background: url(image/monitor.png) no-repeat;"><strong>频谱回放</strong></a>-->
				<!--<a href="javascript:openTab('Um接口电路域查询','um_circuit_domain/circuitQuery.jsp','icon-network')" class="home_icon" style="background: url(image/network.png) no-repeat;"><strong>Um接口电路域查询</strong></a>-->
				<!--<a href="javascript:openTab('干扰分析','/page_interference/interferenceAnalysis.jsp','icon-cellcompare')" class="home_icon" style="background: url(image/cellcompare.png) no-repeat;"><strong>干扰分析</strong></a><br><br>-->
				<!--<a href="javascript:openTab('Um接口分组域查询','/um_packet_domain/packetDomainQuery.jsp','icon-total')" class="home_icon" style="background: url(image/total.png) no-repeat;"><strong>前置机实时性能</strong></a>-->
				<!--<a href="javascript:openTab('网络性能分析','networkAnalysis/test.jsp','icon-monit')" class="home_icon" style="background: url(image/bsccalc.png) no-repeat;"><strong>接口数据查询</strong></a>-->
				<!--<a href="javascript:openTab('网管管理','networkManagement/networkManagementSystem.jsp','icon-yewu')" class="home_icon" style="background: url(image/wangguan.png) no-repeat;"><strong>系统告警</strong></a>-->
				<!--<a href="javascript:openTab('系统管理','/systemConf/systemConf.jsp','icon-jiancetai')" class="home_icon" style="background: url(image/jiancetai.png) no-repeat;"><strong>操作记录</strong></a>-->
			</div>
		</div>
	</div>
</div>



<div region="west" style="width: 250px" title="功能列表" split="true">


	<div class="easyui-accordion" data-options="multiple:true">

	    <div title="频谱监测"  data-options="iconCls:'icon-realtime',collapsed:false,collapsible:false" style="padding:10px;">
			<!--<a href="javascript:openTab('实时入库监测','monitor/shishijiankong.jsp','icon-deploy')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-deploy'" style="width: 170px;">实时入库监测</a>-->
			<a href="javascript:openTab('实时频谱','monitor/fsmonitor.jsp','icon-deploy')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-deploy'" style="width: 170px;text-align: left;">实时频谱</a>
			<a href="javascript:openTab('频谱回放','fsreplay/fsreplay.jsp','icon-conference')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-conference'" style="width: 170px;text-align: left;">频谱回放</a>
		</div>

		<%--<div title="实时监控"  data-options="iconCls:'icon-monitor',collapsed:false,collapsible:false" style="padding:10px;">--%>
			<%--<a href="javascript:openTab('实时数据入库','monitor/shishijiankong.jsp','icon-deploy')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-deploy'" style="width: 170px;text-align: left;">实时入库</a>--%>

		<%--</div>--%>
		<div title="Um接口电路域查询" data-options="iconCls:'icon-network',collapsed:false,collapsible:false" style="padding:10px">
             <!--<a href="javascript:openTab('频谱回放','fsreplay.jsp','icon-yewu')page_interference/InterferenceQuery.jsp" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 150px;">频谱回放</a>
             -->			
            <a href="javascript:openTab('空口信令查询','um_circuit_domain/SDCCHManage.jsp','icon-checklist')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-checklist'" style="width: 170px;text-align: left;">空口信令查询</a>
			<a href="javascript:openTab('测量报告及系统消息查询','um_circuit_domain/SACCHManage.jsp','icon-edittools')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-edittools'" style="width: 190px;text-align: left;">测量报告及系统消息查询</a>
			<!--<a href="javascript:openTab('FACCH信令查询','FACCHManage.jsp','icon-yewu')" vclass="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 150px;">FACCH信令查询</a> -->
			<a href="javascript:openTab('TCH业务查询','um_circuit_domain/TCHManage.jsp','icon-tch')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-tch'" style="width: 170px;text-align: left;">TCH业务查询</a>
 			<!-- <a href="javascript:openTab('测量报告','celiangbaogaoManage.jsp','icon-yewu')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 150px;">测量报告</a>
 			 <a href="javascript:openTab('TCH业务解码查询','tchyewuManage.jsp','icon-yewu')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 150px;">TCH业务解码查询</a>-->
 			<%--um_circuit_domain/singleUserManage.jsp',--%>
 			<%--'um_circuit_domain/singleUserTrack.jsp',--%>
		</div>
		
		<div title="干扰分析" data-options="iconCls:'icon-cellcompare',collapsed:false,collapsible:false" style="padding:10px">
		    <a href="javascript:openTab('实时干扰告警查询','/page_interference/InterferenceQuery.jsp','icon-bank')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-bank'" style="width: 170px;text-align: left;">实时干扰告警查询</a>
 			<a href="javascript:openTab('历史干扰告警查询','/page_interference/InterferenceQueryHistory.jsp','icon-notebooks')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-notebooks'" style="width: 170px;text-align: left;">历史干扰告警查询</a>
			<%--<a href="javascript:openTab('干扰占用度统计','/page_interference/InterferenceOccupy.jsp','icon-notebooks')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-notebooks'" style="width: 170px;text-align: left;">干扰占用度统计</a>--%>
			<c:if test="${currentMemberShip.group.name=='管理员' }">
		    <a href="javascript:openTab('干扰分析设置','/page_interference/InterferenceControl.jsp','icon-notebook')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-notebook'" style="width: 170px;text-align: left;">干扰分析设置</a>
		    
			</c:if>
<!--		<a href="javascript:openTab('基站位置定位','/page_interference/BSStation.jsp','icon-plane')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-plane'" style="width: 150px;text-align: left;">基站位置定位</a>  -->
 			<%-- <c:if test="${currentMemberShip.group.name=='管理员' }">
 			<a href="javascript:openTab('干扰告警级别配置','/page_interference/AlarmConfig.jsp','icon-yewu')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 170px;">干扰告警级别配置</a>
 			<a href="javascript:openTab('干扰参数配置','/page_interference/ParaConfig.jsp','icon-yewu')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 170px;">干扰参数配置</a>
 			</c:if> --%>
<!--  			<a href="javascript:openTab('手动互调干扰计算','/page_interference/CalIntermodu.jsp','icon-yewu')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-yewu'" style="width: 170px;">手动互调干扰计算</a>	
 -->			<c:if test="${currentMemberShip.group.name=='管理员' }">
		    <a href="javascript:openTab('监测点频谱建模','/page_interference/CreateModel.jsp','icon-bookmark')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-bookmark'" style="width: 170px;text-align: left;">监测点频谱建模</a>
			</c:if>
		</div>
		<div title="Um接口分组域查询"  data-options="iconCls:'icon-total',collapsed:false,collapsible:false" style="padding:10px;">
				<a href="javascript:openTab('GMM/SM 业务查询','/um_packet_domain/GPRS_full.jsp','icon-draw')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-draw'" style="width: 170px;text-align: left;">GMM/SM 业务查询</a>
				<a href="javascript:openTab('MAC/RLC信令查询','/um_packet_domain/GPRS_default.jsp','icon-test')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-test'" style="width: 170px;text-align: left;">MAC/RLC信令查询</a>
				<%--/um_packet_domain/GPRS_full_track.jsp','icon-group')"--%>
		</div>
		
	<!--<div title="网络性能分析"  data-options="iconCls:'icon-task',collapsed:false,collapsible:false" style="padding:10px;">
			<a href="javascript:openTab('网络性能分析','/networkAnalysis/test.jsp','icon-monit')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-monit'" style="width: 170px;text-align: left;">网络性能分析</a> 
		</div>  -->
		
		<div title="网管系统" data-options="iconCls:'icon-wangguan',collapsed:false,collapsible:false" style="padding:10px">
			
			<c:choose>
				<c:when test="${currentMemberShip.group.name=='管理员'}">  			      
					<ul id="tree"></ul>
			   	</c:when>
			   <c:otherwise> 
				    <ul id="tree2"></ul>
			   </c:otherwise>
			</c:choose>
			
			
		</div>
		
		<div title="系统管理"  data-options="iconCls:'icon-jiancetai',collapsed:false,collapsible:false" style="padding:10px">
			<c:if test="${currentMemberShip.group.name=='管理员' }">
			<!--<a href="javascript:openScanGate()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-power'" style="width: 150px;">实时扫描开关</a>-->
			
			<a href="javascript:openTab('用户管理','systemConf/userManage.jsp','icon-setup')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-setup'" style="width: 170px;text-align: left;">用户管理</a>
			<a href="javascript:openTab('用户权限管理','systemConf/authManage.jsp','icon-testing')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-testing'" style="width: 170px;text-align: left;">用户权限管理</a>
			<!-- <a href="javascript:openTab('角色管理','userManager/groupManage.jsp','icon-role')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-role'" style="width: 170px">角色管理</a> -->
			
			<a href="javascript:openPasswordModifyDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-modifyPassword'" style="width: 170px;text-align: left;">修改密码</a>
			</c:if>
			<a href="javascript:logout()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-exit'" style="width: 170px;text-align: left;">安全退出</a>
		</div>
		
	</div>
</div>
<div region="south" style="height: 26px;padding: 5px" align="center">
	Copyright © 2016-2023 广州市广源电子科技有限公司 版权所有
</div>

<div id="dlg" class="easyui-dialog" style="width:400px;height:250px;padding: 10px 20px"
   closed="true" buttons="#dlg-buttons">
   
   <form id="fm" method="post">
   	<table cellspacing="8px">
   		<tr>
   			<td>用户名：</td>
   			<td><input type="text" id="userId" name="userId" readonly="readonly" value="${currentMemberShip.user.id }" style="width: 200px"/></td>
   		</tr>
   		<tr>
   			<td>原密码：</td>
   			<td><input type="password" id="oldPassword" name="oldPassword" class="easyui-validatebox" required="true" style="width: 200px"/></td>
   		</tr>
   		<tr>
   			<td>新密码：</td>
   			<td><input type="password" id="newPassword" name="newPassword" class="easyui-validatebox" required="true" style="width: 200px"/></td>
   		</tr>
   		<tr>
   			<td>确认新密码：</td>
   			<td><input type="password" id="newPassword2" name="newPassword2" class="easyui-validatebox" required="true" style="width: 200px"/></td>
   		</tr>
   	</table>
   </form>
 </div>
 
 <div id="dlg-buttons">
 	<a href="javascript:modifyPassword()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
 	<a href="javascript:closePasswordModifyDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
 </div>
<audio id="mp3"  src="${pageContext.request.contextPath}/static/music/y1054.mp3"></audio>
</body>
<script type="text/javascript">
     // setInterval("myInterval()", 10000);
    var lastTotal = 0;
    function myInterval() {

        $.post("${pageContext.request.contextPath}/alarmInfo/getTotal.do", {
            lastTotal : lastTotal
        }, function(result) {

            if (result.total > 0 && (result.total - lastTotal > 0)
                && result.rows.length > 0 && lastTotal > 0) {
                $(function(){
                    function playSound(src) {
                        var auto = $("#auto");
                        auto.attr("src",src);
                    }
                })
                for (var i = 0; i < result.rows.length; i++) {
                    var desc = "有新的故障告警信息";
                    var type = result.rows[i]["alarmType"];
                    if (type == "5") {
                        desc = "前置机掉电重启"
                    } else
                        if (type == "4") {
                        desc = "前置机故障"
                    } else if (type == "3") {
                        desc = "服务器硬盘使用率告警"
                    } else if (type == "2") {
                        desc = "服务器内存使用率告警"
                    } else if (type == "1") {
                        desc = "服务器CPU使用率告警"
                    } else if (type == "20") {
                        desc = "频谱数据入库异常"
                    } else if (type == "7") {
                        desc = "前置机CPU使用率告警"
                    } else if (type == "8") {
                        desc = "前置机内存使用率告警"
                    } else if (type == "9") {
                        desc = "前置机硬盘使用率告警"
                    }
                    else if(type==10) {
                        desc =  "前置机网络连接告警";
                    }
                    else if(type==15) {
                            desc =  "上行无数据告警";
                        }
                        else if(type==21) {
                            desc =  "电路域数据入库异常";
                        }
                    if(desc=="有新的故障告警信息"){
                            continue;
					}
                    // else if(type==11) {
                    //     desc =  "GPRS数据中断告警";
                    // }else if(type==12) {
                    //     desc =  "GPRS数据CRC校验异常";
                    // }

                    $.messager.alert("系统告警", desc);
                    document.getElementById("mp3").play();
                    // var vid=document.getElementById("mp3").play();
                    // var start = 0;//定义循环的变量
                    // var times=3;//定于循环的次数
                    // vid.addEventListener("ended",function() {
                    //     vid.play();//启动音频，也就是播放
                    //     start++;//循环
                    //     start == times && vid.pause();//也就是当循环的变量等于次数的时候，就会终止循环并且关掉音频
                    // });
                }
            }
            lastTotal = result.total;
        }, "json");
    }
</script>
</html>
